package com.wyj.demo.ui.dialog

import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.ViewGroup
import android.view.Window
import com.custom.base.common.util.isLogin
import com.custom.util.getView
import com.wyj.demo.R

class LoginDialog(context: Context) : Dialog(context, R.style.Mi_Dialog) {
    var nowActivity: Activity = context as Activity

    init {
        setContentView(getView(R.layout.login_activity))
        //设置弹出位置
        this.window?.setGravity(Gravity.BOTTOM);
        //设置弹出动画
        //this.window?.setWindowAnimations(R.style.main_menu_animStyle);
        //设置对话框大小
        this.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    }

    override fun cancel() {
        super.cancel()
        if (!isLogin()) {
            LoginDialog(nowActivity).show()
        }
    }

}